package com.yanqu.road.entity.activity.celebration;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.utils.string.StringUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * @Description
 * @Author cwq
 * @Data 2022/4/24 16:34
 */
public class CelebrationActivityConfig {

    /**
     * 配置
     */
    private List<CelebrationScoreConfig> scoreConfigList = new ArrayList<>();
    private HashMap<Integer, CelebrationScoreConfig> scoreConfigMap = new HashMap<>();

    /**
     * 活动道具
     */
    private List<Integer> propList = new ArrayList<>();
    private int CELEBRATION_SCORE_ITEM_ID;

    public List<CelebrationScoreConfig> getScoreConfigList() {
        return scoreConfigList;
    }

    public void setScoreConfigList(List<CelebrationScoreConfig> scoreConfigList) {
        this.scoreConfigList = scoreConfigList;
    }

    public HashMap<Integer, CelebrationScoreConfig> getScoreConfigMap() {
        return scoreConfigMap;
    }


    public List<Integer> getPropList() {
        return propList;
    }


    public int getCELEBRATION_SCORE_ITEM_ID() {
        return CELEBRATION_SCORE_ITEM_ID;
    }


    /**
     * 解析参数
     *
     * @param activityInfo
     */
    public void parseConfig(ActivityInfo activityInfo) {
        // 加载活动配置
        scoreConfigList.forEach(e -> {
            scoreConfigMap.put(e.getId(), e);
        });
        propList = StringUtils.stringToIntegerList(activityInfo.getParam3(), "\\|");
        CELEBRATION_SCORE_ITEM_ID = (Integer.valueOf(activityInfo.getParam2()));

    }

}
